Removed the event server, and all it entails. This is unused, and a big pile
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Mon, 31 Oct 2005 15:56:34 +0000 (16:56 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Mon, 31 Oct 2005 15:56:34 +0000 (16:56 +0100)
of crusty rubbish.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/examples/xend-config.sxp
tools/python/xen/xend/XendRoot.py
tools/python/xen/xend/server/SrvDaemon.py
tools/python/xen/xend/server/event.py [deleted file]

index 13c38de24e8ec29d279c9c1c4e4f69f64a48a98c..f600edc19d898ad9ec8d00a9901b7229c7294557 100644 (file)
@@ -25,9 +25,6 @@
 # Port xend should use for the HTTP interface, if xend-http-server is set.
 #(xend-port            8000)
 
-# Port xend should use for the event interface.  This interface is deprecated.
-#(xend-event-port      8001)
-
 # Port xend should use for the relocation interface, if xend-relocation-server
 # is set.
 #(xend-relocation-port 8002)
index 564bc75ed3606ab4e2ee8eee74c73f5ec58cf23b..29398df90170ceb529e11605ebc16976eec18882 100644 (file)
@@ -17,7 +17,7 @@
 #============================================================================
 
 """Xend root class.
-Creates the event server and handles configuration.
+Creates the servers and handles configuration.
 
 Other classes get config variables by importing this module,
 using instance() to get a XendRoot instance, and then
@@ -72,9 +72,6 @@ class XendRoot:
     """Default port xend serves HTTP at. """
     xend_port_default         = '8000'
 
-    """Default port xend serves events at. """
-    xend_event_port_default   = '8001'
-
     """Default port xend serves relocation at. """
     xend_relocation_port_default = '8002'
 
@@ -210,21 +207,16 @@ class XendRoot:
         """
         return self.get_config_int('xend-port', self.xend_port_default)
 
-    def get_xend_event_port(self):
-        """Get the port xend listens at for connection to its event server.
-        """
-        return self.get_config_int('xend-event-port', self.xend_event_port_default)
-
     def get_xend_relocation_port(self):
         """Get the port xend listens at for connection to its relocation server.
         """
         return self.get_config_int('xend-relocation-port', self.xend_relocation_port_default)
 
     def get_xend_address(self):
-        """Get the address xend listens at for its HTTP and event ports.
+        """Get the address xend listens at for its HTTP port.
         This defaults to the empty string which allows all hosts to connect.
         If this is set to 'localhost' only the localhost will be able to connect
-        to the HTTP and event ports.
+        to the HTTP port.
         """
         return self.get_config_value('xend-address', self.xend_address_default)
 
@@ -232,7 +224,7 @@ class XendRoot:
         """Get the address xend listens at for its relocation server port.
         This defaults to the empty string which allows all hosts to connect.
         If this is set to 'localhost' only the localhost will be able to connect
-        to the HTTP and event ports.
+        to the relocation port.
         """
         return self.get_config_value('xend-relocation-address', self.xend_relocation_address_default)
 
index ce8b1a4e608affc03b7aa621821c597e6971fc7a..5c1a8f7f693b1a6f69f58cceabb6f6211d221c80 100644 (file)
@@ -19,7 +19,6 @@ import xen.lowlevel.xc
 from xen.xend.server import SrvServer
 from xen.xend.XendLogging import log
 
-import event
 import relocate
 from params import *
 
@@ -273,7 +272,6 @@ class Daemon:
             log.info("Xend changeset: %s.", xinfo['xen_changeset'])
             del xc
 
-            event.listenEvent(self)
             relocate.listenRelocation()
             servers = SrvServer.create()
             self.daemonize()
diff --git a/tools/python/xen/xend/server/event.py b/tools/python/xen/xend/server/event.py
deleted file mode 100644 (file)
index ab03c2c..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#============================================================================
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#============================================================================
-# Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
-# Copyright (C) 2005 XenSource Ltd
-#============================================================================
-
-import sys
-import StringIO
-
-from xen.web import protocol, tcp, unix
-
-from xen.xend import scheduler
-from xen.xend import sxp
-from xen.xend import PrettyPrint
-from xen.xend.XendError import XendError
-from xen.xend import XendLogging
-from xen.xend import XendRoot
-
-
-xroot = XendRoot.instance()
-
-
-DEBUG = 0
-
-class EventProtocol(protocol.Protocol):
-    """Asynchronous handler for a connected event socket.
-    """
-
-    def __init__(self, daemon):
-        #protocol.Protocol.__init__(self)
-        self.daemon = daemon
-        # Event queue.
-        self.queue = []
-        self.parser = sxp.Parser()
-        self.pretty = 1
-
-    def dataReceived(self, data):
-        try:
-            self.parser.input(data)
-            while(self.parser.ready()):
-                val = self.parser.get_val()
-                res = self.dispatch(val)
-                self.send_result(res)
-            if self.parser.at_eof():
-                self.loseConnection()
-        except SystemExit:
-            raise
-        except:
-            self.send_error()
-
-    def loseConnection(self):
-        if self.transport:
-            self.transport.loseConnection()
-        if self.connected:
-            scheduler.now(self.connectionLost)
-
-    def connectionLost(self, reason=None):
-        pass
-
-    def send_reply(self, sxpr):
-        io = StringIO.StringIO()
-        if self.pretty:
-            PrettyPrint.prettyprint(sxpr, out=io)
-        else:
-            sxp.show(sxpr, out=io)
-        print >> io
-        io.seek(0)
-        if self.transport:
-            return self.transport.write(io.getvalue())
-        else:
-            return 0
-
-    def send_result(self, res):
-        if res is None:
-            resp = ['ok']
-        else:
-            resp = ['ok', res]
-        return self.send_reply(resp)
-
-    def send_error(self):
-        (extype, exval) = sys.exc_info()[:2]
-        return self.send_reply(['err',
-                                ['type', str(extype)],
-                                ['value', str(exval)]])
-
-    def send_event(self, val):
-        return self.send_reply(['event', val[0], val[1]])
-
-    def queue_event(self, name, v):
-        # Despite the name we don't queue the event here.
-        # We send it because the transport will queue it.
-        self.send_event([name, v])
-        
-    def opname(self, name):
-         return 'op_' + name.replace('.', '_')
-
-    def operror(self, name, req):
-        raise XendError('Invalid operation: ' +name)
-
-    def dispatch(self, req):
-        op_name = sxp.name(req)
-        op_method_name = self.opname(op_name)
-        op_method = getattr(self, op_method_name, self.operror)
-        return op_method(op_name, req)
-
-    def op_help(self, _1, _2):
-        def nameop(x):
-            if x.startswith('op_'):
-                return x[3:].replace('_', '.')
-            else:
-                return x
-        
-        l = [ nameop(k) for k in dir(self) if k.startswith('op_') ]
-        return l
-
-    def op_quit(self, _1, _2):
-        self.loseConnection()
-
-    def op_exit(self, _1, _2):
-        sys.exit(0)
-
-    def op_pretty(self, _1, _2):
-        self.pretty = 1
-
-    def op_info(self, _1, _2):
-        val = ['info']
-        #val += self.daemon.blkifs()
-        #val += self.daemon.netifs()
-        #val += self.daemon.usbifs()
-        return val
-
-    def op_trace(self, _, v):
-        mode = (v[1] == 'on')
-        self.daemon.tracing(mode)
-
-    def op_log_stderr(self, _, v):
-        mode = v[1]
-        if mode == 'on':
-            XendLogging.addLogStderr()
-        else:
-            XendLogging.removeLogStderr()
-
-    def op_domain_ls(self, _1, _2):
-        xd = xroot.get_component("xen.xend.XendDomain")
-        return xd.list_names()
-
-    def op_domain_configure(self, _, v):
-        domid = sxp.child_value(v, "dom")
-        config = sxp.child_value(v, "config")
-        if domid is None:
-            raise XendError("missing domain id")
-        if config is None:
-            raise XendError("missing domain config")
-        xd = xroot.get_component("xen.xend.XendDomain")
-        xd.domain_configure(domid, config)
-
-    def op_domain_unpause(self, _, v):
-        domid = sxp.child_value(v, "dom")
-        if domid is None:
-            raise XendError("missing domain id")
-        xd = xroot.get_component("xen.xend.XendDomain")
-        xd.domain_unpause(domid)
-
-class EventFactory(protocol.ServerFactory):
-    """Asynchronous handler for the event server socket.
-    """
-
-    def __init__(self, daemon):
-        protocol.ServerFactory.__init__(self)
-        self.daemon = daemon
-
-    def buildProtocol(self, _):
-        return EventProtocol(self.daemon)
-
-def listenEvent(daemon):
-    factory = EventFactory(daemon)
-    if xroot.get_xend_unix_server():
-        path = '/var/lib/xend/event-socket'
-        unix.listenUNIX(path, factory)
-    if xroot.get_xend_http_server():
-        port = xroot.get_xend_event_port()
-        interface = xroot.get_xend_address()
-        l = tcp.listenTCP(port, factory, interface=interface)
-        l.setCloExec()